void FindBlobs(const cv::Mat &binary, vector < vector<cv::Point2i>  > &blobs)
{
    blobs.clear();
 
    // Fill the label_image with the blobs
    // 0  - background
    // 1  - unlabelled foreground
    // 2+ - labelled foreground
 
    cv::Mat label_image;
    binary.convertTo(label_image, CV_32FC1); // weird it doesn't support CV_32S!
 
    int label_count = 2; // starts at 2 because 0,1 are used already
 
    for(int y=0; y < binary.rows; y++) {
        for(int x=0; x < binary.cols; x++) {
            if((int)label_image.at(y,x) != 1) {
                continue;
            }
 
            cv::Rect rect;
            cv::floodFill(label_image, cv::Point(x,y), cv::Scalar(label_count), 
                          &rect, cv::Scalar(0), cv::Scalar(0), 4);
 
            std::vector   blob;
 
            for(int i=rect.y; i < (rect.y+rect.height); i++) {
                for(int j=rect.x; j < (rect.x+rect.width); j++) {
                    if((int)label_image.at(i,j) != label_count) {
                        continue;
                    }
 
                    blob.push_back(cv::Point2i(j,i));
                }
            }
 
            blobs.push_back(blob);
 
            label_count++;
        }
    }
}
